package com.kma.ncpractice2013.auth;

import javax.xml.bind.DatatypeConverter;
import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Arrays;

/**
 * User: Viktor
 * Date: 10/11/13
 */
public class Crypto
{
	public static String getHash(String salt, String pass, String algorithm) throws UnsupportedEncodingException, NoSuchAlgorithmException
    {

		MessageDigest messageDigest = null;
		messageDigest = MessageDigest.getInstance(algorithm);



		messageDigest.update((salt + pass).getBytes("UTF-8"));
        return DatatypeConverter.printHexBinary(messageDigest.digest());


	}
}
